package cn.kgc.bdqn_studentinfomanager.controller;

import cn.kgc.bdqn_studentinfomanager.pojo.vo.ChannelManagerInfoVo;
import cn.kgc.bdqn_studentinfomanager.pojo.vo.ReturnManagerInfoVo;
import cn.kgc.bdqn_studentinfomanager.service.AdminService.AdminService;
import com.alibaba.fastjson.JSONArray;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * by Shanshui CC on 2020/12/21 10:45
 */
@RestController
@RequestMapping("/print")
@CrossOrigin
public class AdminController {

    @Resource
    private AdminService adminService;

    @RequestMapping("/allInfo")
    public void allInfo(@RequestBody List<ReturnManagerInfoVo> returnManagerInfoVoList, HttpServletResponse response){
        response.setHeader("Access-Control-Allow-Origin", "*");
        response.setHeader("Cache-Control","no-cache");
        adminService.printChannelManagerData(returnManagerInfoVoList,response);
    }
//    @RequestMapping(value = "/allInfo")
//    public void print(@RequestParam String lists, HttpServletResponse response){
//        response.setHeader("Access-Control-Allow-Origin", "*");
//        response.setHeader("Cache-Control","no-cache");
//        List<ReturnManagerInfoVo> list = JSONArray.parseArray(lists, ReturnManagerInfoVo.class);
//        adminService.printChannelManagerData(list,response);
//    }
}
